import java.beans.*;

/**
 * @author zhu
 * @date 2024-03-28
 */
public class MainTest01 {
    public static void main(String[] args) throws Exception {
        BeanInfo beanInfo = Introspector.getBeanInfo(Person.class,Object.class);

        PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors();

        for (PropertyDescriptor propertyDescriptor : propertyDescriptors){
            Class<?> propertyType = propertyDescriptor.getPropertyType();
            String simpleName = propertyType.getSimpleName();
            String name = propertyDescriptor.getName();
            System.out.println("属性名称：" + name);
            System.out.println("属性类型：" + simpleName);
        }
    }
}
